home *** CD-ROM | disk | FTP | other *** search
/ Amiga ISO Collection / AmigaUtilCD2.iso / Programming / C / hf^k-2.dms / in.adf / MUIClass.Lha / Demo / Demo2 / Class.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1996-11-17  |  1.7 KB  |  71 lines

  1. #include <clib/alib_protos.h>
  2. #include "Class.h"
  3.  
  4. TWiWin::TWiWin()
  5.     :   MUIWindow(),
  6.         BSave("_Save"),
  7.         BUse("_Use"),
  8.         BCancel("_Cancel"),
  9.         MsgSave(0L,"Demo-Message","_Ok","Es wurde 'Save' gedrückt",0UL),
  10.         MsgUse(0L,"Demo-Message","_Ok","Es wurde 'Use' gedrückt",0UL),
  11.         MsgCan(0L,"Demo-Message","_Ok","Es wurde 'Cancel' gedrückt",0UL)
  12.     {
  13.     Create(
  14.         MUIA_Window_Title, "TWiDVI Ver 1.0",
  15.         MUIA_Window_ID,    MakeID('T','D','V','I'),
  16.         WindowContents,    HGroup,
  17.             MUIA_Group_SameSize, TRUE,
  18.             Child, (Object *)BSave,
  19.             Child, (Object *)BUse,
  20.             Child, (Object *)BCancel,
  21.             End,
  22.         TAG_DONE);
  23.     BSave.CycleChain(1);
  24.     BUse.CycleChain(1);
  25.     BCancel.CycleChain(1);
  26.     DefaultObject(BSave);
  27.     BSave.Notify(MUIA_Pressed,   FALSE, *this, 1, MUIM_Demo_Save);
  28.     BUse.Notify(MUIA_Pressed,    FALSE, *this, 1, MUIM_Demo_Use);
  29.     BCancel.Notify(MUIA_Pressed, FALSE, *this, 1, MUIM_Demo_Cancel);
  30.     };
  31.  
  32. TWiWin::~TWiWin()
  33.     {
  34.     }
  35.  
  36. void TWiWin::save()
  37.     {
  38.     MsgSave.show(*AppClass(),*this);
  39.     };
  40.  
  41. void TWiWin::use()
  42.     {
  43.     MsgUse.show(*AppClass(),*this);
  44.     };
  45.  
  46. void TWiWin::cancel()
  47.     {
  48.     MsgCan.show(*AppClass(),*this);
  49.     };
  50.  
  51. ULONG TWiWin::UserDispatch(struct IClass *cl, Object *obj, Msg msg)
  52.     {
  53.     ULONG rc = 0UL;
  54.     switch(msg->MethodID)
  55.         {
  56.         case MUIM_Demo_Save:
  57.             save();
  58.             break;
  59.         case MUIM_Demo_Use:
  60.             use();
  61.             break;
  62.         case MUIM_Demo_Cancel:
  63.             cancel();
  64.             break;
  65.         default:
  66.             rc = DoSuperMethodA(cl,obj,msg);
  67.             break;
  68.         }
  69.     return(rc);
  70.     };
  71.